/*
 * @Description:
 * @Date: 2023-11-01 20:45:16
 * @LastEditTime: 2023-12-16 13:22:55
 */
import { createVNode, render } from 'vue';
import Dialog from './index.vue';
const divDom = document.createElement('div');
divDom.setAttribute('class', 'u-dialog-modal-container');
document.body.appendChild(divDom);

const dialogPlguin = option => {
    return new Promise((resolve, reject) => {
        const okButton = () => {
            //确认
            render(null, divDom);
            resolve();
        };
        const cancelButton = () => {
            //  取消
            render(null, divDom);
            reject(new Error('取消'));
        };

        const vNode = createVNode(Dialog, { ...option, okButton, cancelButton });
        render(vNode, divDom);
    });
};
export default dialogPlguin;
